Let xstrdup clone null strings into empty strings.
authorrobertl <robertl>
Mon, 1 Nov 2004 17:37:16 +0000 (17:37 +0000)
committerrobertl <robertl>
Mon, 1 Nov 2004 17:37:16 +0000 (17:37 +0000)
util.c

diff --git a/util.c b/util.c
index 975b7598fe83f955844d98c45086cc34c173aac1..c58520ac068f5a5e00ee013eda4fc25808f740b8 100644 (file)
--- a/util.c
+++ b/util.c
@@ -121,7 +121,7 @@ XSTRDUP(const char *s, DEBUG_PARAMS )
 xstrdup(const char *s)
 #endif
 {
-       char *o = strdup(s);
+       char *o = s ? strdup(s) : strdup("");
 #ifdef DEBUG_MEM
        debug_mem_output( "strdup, %x, %x, %s, %d\n", 
                        o, s, file, line );